gusucode.com > 支持向量机工具箱 - LIBSVM OSU_SVM LS_SVM源码程序 > 支持向量机工具箱 - LIBSVM OSU_SVM LS_SVM\stprtool\linear\linclass.m

    function [Ipred, Fx ]=linclass(X,alpha,theta)
% LINCLASS classifier based on linear discriminat function.
%  [Ipred, Fx ]=linclass(X,alpha,theta)
%
% LINCLASS is the classifier based on a linear decision rule.
%   The matrix X contains patterns to be classified into to classes.
%   The linear classifier is detrmined by the vector alpha and
%   the threshold theta.
%   The result of the classifier is the vector J containing class labels.
%
%   The classifier rule is:
%       class 1     ->     alpha'*x >= theta
%       class 2     ->     alpha'*x < theta
%

% Statistical Pattern Recognition Toolbox, Vojtech Franc, Vaclav Hlavac
% (c) Czech Technical University Prague, http://cmp.felk.cvut.cz
% Written Vojtech Franc (diploma thesis) 02.01.2000
% Modifications
% 24. 6.00 V. Hlavac, comments polished.


K=size(X,2);     % # of samples
DIM=size(X,1);   % dimension

E=ones(1,K);
Fx=alpha(:)'*X-theta*E;

Ypred = sign( Fx );
Ypred( find( Ypred == 0 )) = 1;
Ipred = sgntoi( Ypred );

return;